<script>
$(function(){
	$('#start_date').val(INPUT_POST.start_date);
	$('#end_date').val(INPUT_POST.end_date);
	
	// autocomplete
	$('#searchUser').autocomplete('?app=daily&mod=report&opt=getuser',{
		multiple:false,
		width:150,
		multipleSepartator:'',
		dataType:'json',
		minChars:0,
		parse: function(data) {
			var rows = [];
			for (var i=0; i<data.length ;i++ )
			{
				rows[rows.length] = {
					data: data[i].username,
					value: data[i].username,
					result:data[i].username
				};
			}
			return rows;
		},
		formatItem: function(row,i,n) {
			return row;
		},
		formatResult: function(row,i,n) {
			return row;
		},
		formatMatch: function(row,i,max) {
			return row;
		}
	});
});
</script>
<style>
.ac_results {
	padding: 0px;
	border: 1px solid black;
	background-color: white;
	overflow: hidden;
	z-index: 99999;
}

.ac_results ul {
	width: 100%;
	list-style-position: outside;
	list-style: none;
	padding: 0;
	margin: 0;
}

.ac_results li {
	margin: 0px;
	padding: 2px 5px;
	cursor: default;
	display: block;
	/* 
	if width will be 100% horizontal scrollbar will apear 
	when scroll mode will be used
	*/
	/*width: 100%;*/
	font: menu;
	font-size: 12px;
	/* 
	it is very important, if line-height not setted or setted 
	in relative units scroll will be broken in firefox
	*/
	line-height: 16px;
	overflow: hidden;
}

.ac_loading {
	background: white url('indicator.gif') right center no-repeat;
}

.ac_odd {
	background-color: #eee;
}

.ac_over {
	background-color: #0A246A;
	color: white;
}
</style>
<style>
.table2{border:#CCC solid 1px; border-bottom:0px; border-right:0px;}
.table2 th{border:#bbb solid 1px; border-top:#fff solid 1px; border-left:#fff solid 1px; text-align:center; padding:4px; background:#ddd;}
.table2 td{border:#CCC solid 1px; border-top:0px; border-left:#fff solid 1px; text-align:center; padding:2px;}
.table2 .th0{width:20px;}
.table2 .th2{width:15px;}
.table2 .th3{width:160px;}
.smallTd{border:#bbb solid 1px; border-top:#fff solid 1px; border-left:#fff solid 1px; text-align:center; padding:4px; background:#ddd;}
</style>
<div class="search">
    <form id='search' method="get">
        <span>查询人：
            <input type="text" name="searchUser" id="searchUser" rel="searchUser"  value="<?=$this->sel_UName?>" />
        </span>
        <span><input type="submit" value="搜索" /><?php echo showhide(array('app'=>APP,'mod'=>MOD)); ?></span>
    </form>
</div>
<div class="line_1"></div>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="table2">
       <tr>
            <th class="th0" rel="loan_id">编号</th>
            <th class="th0" rel="nickname">职员姓名</th>
            <th class="th0" rel="nickname">总欠款金额</th>
            <th class="th0" rel="nickname">总欠款次数</th>
            <th class="th0" rel="nickname">已还金额</th>
            <th class="th0"></th>
       </tr>
       <?php $loopindex=0;foreach((array)$this->result as $key=>$value): ?> 
         <tr>
         	<td><?php echo ($loopindex+1); ?></td>
            <td><?php echo $value['nickname']; ?></td>
            <td><?php echo $value['total_price']; ?></td>
            <td><?php echo $value['total_count']; ?></td>
            <td><?php echo $value['total_arr_price']; ?></td>
            <td>
            	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="table1">
            	<?php foreach((array)$value['items'] as $rkey=>$ritem): ?> 
                	<tr>
            			<th class="th0" >欠款日期</th>
                        <th class="th0" >欠款金额</th>
                        <th class="th0" >已还金额</th>
                    </tr>
            		<tr>
                    	<td class="th0"><?php echo date('Y-m-d',$ritem['created_time']); ?></td>
                        <td class="th0"><?php echo $ritem['price']; ?></td>
                        <td class="th0"><?php echo $ritem['arr_price']; ?></td>
                    </tr>
            	<?php endforeach; ?>
                </table>
            </td>
         </tr>
       <?php $loopindex++; endforeach; ?>
</table>